package com.example.ccj.b.c.ui;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
/**
 * TabLayout + ViewPager2 + Fragment 实现自定义底部栏控件的module
 *
 * 2022年10月27日13:22:23
 */
public class TableAndViewPageBean {
    private int icon; //未选中时的图片
    private int iconSelected; //选中时的图片
    private @NonNull String text; //显示的文本
    private Fragment fragment; //关联的fragment
    private BottomIconSelectListener bottomIconSelectListener;

    public TableAndViewPageBean(@NonNull String text, int icon, int iconSelected, Fragment fragment,BottomIconSelectListener bottomIconSelectListener){
        this.fragment = fragment;
        this.icon = icon;
        this.iconSelected = iconSelected;
        this.text = text;
        this.bottomIconSelectListener = bottomIconSelectListener;
    }

    public TableAndViewPageBean(@NonNull String text, int icon, int iconSelected, Fragment fragment){
        this.fragment = fragment;
        this.icon = icon;
        this.iconSelected = iconSelected;
        this.text = text;
    }

    public TableAndViewPageBean(@NonNull String text, Fragment fragment){
        this.fragment = fragment;
        this.text = text;
    }

    public int getIcon() { return icon; }

    public void setIcon(int icon) { this.icon = icon; }

    public int getIconSelected() { return iconSelected; }

    public void setIconSelected(int iconSelected) { this.iconSelected = iconSelected; }

    public String getText() { return text; }

    public void setText(@NonNull String text) { this.text = text; }

    public Fragment getFragment() { return fragment; }

    public void setFragment(Fragment fragment) { this.fragment = fragment; }

    public BottomIconSelectListener getBottomIconSelectListener() {
        return bottomIconSelectListener;
    }

    public void setBottomIconSelectListener(BottomIconSelectListener bottomIconSelectListener) {
        this.bottomIconSelectListener = bottomIconSelectListener;
    }

    @Override
    public String toString() {
        return "TableAndViewPage{" +
                "icon=" + icon +
                ", iconSelected=" + iconSelected +
                ", text='" + text + '\'' +
                ", fragment=" + fragment +
                '}';
    }

    public interface BottomIconSelectListener{
        void onSelected(TableAndViewPageBean tableAndViewPageBean);
    }
}
